<?php
namespace app\index\controller;

use think\Controller;

class baseproject extends Controller
{
    /**
     *  添加
     */
    public function add()
    {
        $model = model('Project');
        if (request()->instance()->isPost()) {
            $post = request()->instance()->param();

            $data["title"] = $post["title"];
            $data["p_type"] = $post["p_type"];
            $data["company_id"] = $post["company_id"];
            $data["pm_uid"] = $post["pm_uid"];
            $data["market_id"] = $post["market_id"];
            $data["pact_time"] = $post["pact_time"];
            $data["day"] = $post["day"];
  
            $data["status"] = 1;
            $data["owner_id"] = $post["owner_id"];
            $data["price"] = $post["price"];

            $ProjectModel = model("Project");
            $result = $ProjectModel->save($data);
            if (empty($result)) {
                $this->error("操作失败");

            }
            $this->success("操作成功", url("/index/home/index"));
        }
        $data["users"]=model("admin")->where(["role_id"=>array("NEQ",1)])->select();
        //项目类型
        $data["code_list"]=model("CodeMap")->get_value("project_type");
         //业主单位
         $data["yz_list"]  =model("Company")->where(["c_type"=>6])->select();
        //总包单位
        $data["zb_list"]=   model("Company")->where(["c_type"=>1])->select();
        $this->assign($data);
        return view("project/index/add");
    }

}